// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   PxSpPro.java

package com.oa.hr.cultivate;

import com.oa.database.DataConn;
import com.oa.database.QueryData;
import java.io.PrintStream;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;

// Referenced classes of package com.oa.hr.cultivate:
//            PxSpItem

public class PxSpPro extends QueryData
{

    private String tablenamestr;
    private String fieldarraystr;
    private String fieldSort;
    private String conditionstr;
    private DataConn dataConn;
    private ArrayList cusList;
    private String PXBT;
    private String PXFS;
    private String YGXM;
    private int SPRID;
    private int SWSPID;
    private int SJLCID;
    private int SFSP;
    private int BLZT;
    private String SWLB;

    public PxSpPro()
    {
        tablenamestr = null;
        fieldarraystr = null;
        fieldSort = null;
        conditionstr = null;
        dataConn = null;
        cusList = new ArrayList();
        PXBT = null;
        PXFS = null;
        YGXM = null;
        SPRID = 0;
        SWSPID = 0;
        SJLCID = 0;
        SFSP = 0;
        BLZT = -1;
        SWLB = null;
    }

    public void setSWLB(String SWLB)
    {
        this.SWLB = SWLB;
    }

    public void setSPRID(int SPRID)
    {
        this.SPRID = SPRID;
    }

    public void setBLZT(int BLZT)
    {
        this.BLZT = BLZT;
    }

    public void setYGXM(String YGXM)
    {
        this.YGXM = YGXM;
    }

    public void setPXBT(String PXBT)
    {
        this.PXBT = PXBT;
    }

    public void setPXFS(String PXFS)
    {
        this.PXFS = PXFS;
    }

    public Collection getList(int sort, int currentPage, int pageSize)
        throws SQLException
    {
        ResultSet rs = null;
        String sqlStrig = null;
        QueryData queryData = null;
        try
        {
            dataConn = new DataConn();
            if(dataConn.getConnection() != null)
            {
                queryData = new QueryData(dataConn);
                tablenamestr = "OA_YG_PXGL a, OA_GYLC_BL b";
                fieldarraystr = "a.PXID,a.PXBT,a.JHFY,a.PXQSSJ,a.PXJSSJ,a.PXFS,b.BLID,b.BLXXID, b.BLKS,b.BLQX,b.BLLX";
                fieldSort = "b.BLID";
                conditionstr = "a.PXID = b.BLXXID and b.SWLB='" + SWLB + "'" + " and  b.XXBM='OA_YG_PXGL' " + " and b.BLRY = '" + SPRID + "' and b.ISDRAFT <> 1";
                if(BLZT == 1)
                    conditionstr += " and b.BLZT = 1 and b.BLGRZT = 0";
                else
                if(BLZT == 2)
                    conditionstr += " and b.BLGRZT <> 0";
                if(PXBT != null)
                    conditionstr = conditionstr + " and a.PXBT like '%" + PXBT + "%'";
                if(YGXM != null)
                    conditionstr = conditionstr + " and a.YGXM like '%" + YGXM + "%'";
                if(PXFS != null)
                    conditionstr = conditionstr + " and a.PXFS like '%" + PXFS + "%'";
                queryData.setMultRecordSet(tablenamestr, fieldarraystr, conditionstr, fieldSort, sort, currentPage, pageSize);
                iPageCount = queryData.getPageCount();
                iRecordCount = queryData.getRecordCount();
                iCurrentPage = queryData.getCurrentPage();
                PxSpItem bean;
                for(rs = queryData.getResultSet(); rs.next(); cusList.add(bean))
                {
                    bean = new PxSpItem();
                    bean.setPXID(rs.getInt(2));
                    bean.setPXBT(rs.getString(3));
                    bean.setJHFY(rs.getFloat(4));
                    bean.setPXQSSJ(rs.getString(5));
                    bean.setPXJSSJ(rs.getString(6));
                    bean.setPXFS(rs.getString(7));
                    bean.setBLID(rs.getInt(8));
                    bean.setBLXXID(rs.getInt(9));
                    bean.setBLKSSJ(rs.getDate(10));
                    bean.setBLQX(rs.getInt(11));
                    bean.setBLLX(rs.getString(12));
                }

                rs.close();
            }
        }
        catch(SQLException e)
        {
            System.out.println(e.getMessage());
            throw e;
        }
        finally
        {
            dataConn.close();
        }
        return cusList;
    }

    public static void main(String args[])
    {
        PxSpPro pxSpPro = new PxSpPro();
        pxSpPro.setSWLB("3");
        pxSpPro.setSPRID(40);
        pxSpPro.setBLZT(1);
        java.util.Iterator pxSpItems;
        try
        {
            pxSpItems = pxSpPro.getList(1, 1, 20).iterator();
        }
        catch(Exception e)
        {
            System.out.println("AAAAA" + e.getMessage());
        }
    }
}
